﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using YoloDotNet;
using YoloDotNet.Models;

namespace YoloImageDetect
{
    public class YoloDotNetDetector : IDisposable
    {
        private readonly Yolo _yolo;

        /// <summary>
        /// 初始化 YOLO 模型
        /// </summary>
        /// <param name="modelPath">ONNX 模型路径</param>
        /// <param name="confidence">最小置信度 (0-1)</param>
        /// <param name="iou">NMS IoU 阈值</param>
        public YoloDotNetDetector(string modelPath, float confidence = 0.25f, float iou = 0.45f)
        {
            if (string.IsNullOrEmpty(modelPath) || !File.Exists(modelPath))
                throw new FileNotFoundException("模型文件不存在", modelPath);

            // 使用 OnnxRuntime 加载 YOLO 模型
            _yolo = new Yolo(new YoloOptions
            {
                
            });
        }
        public void Dispose()
        {
            _yolo?.Dispose();
        }
    }
}
